package com.settlement.system.controller;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.settlement.system.common.annotation.Swagger;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.ResetOrderAudit;
import com.settlement.system.service.IBaseService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author
 */
@Slf4j
@Api(tags = "订单稽核静态数据", description = "订单稽核静态数据")
@RestController
@RequestMapping("/order/audit/static")
@Swagger
public class OrderAuditStaticReportController extends ExcelController<ResetOrderAudit> {

    /*@Reference(version = "${dubbo.acs.api.version}", timeout = 6000, async = true)
    private StaticReportApi staticReportApi;*/

    @Override
    public Class<?> getModelClass() {
        return ResetOrderAudit.class;
    }

    @Override
    public IBaseService init() {
        return null;
    }

    @Override
    protected void saveData(List<ResetOrderAudit> datas) throws ServiceException {
        try {
            log.info("重置订单稽核静态数据 入参：{}", JSONArray.toJSONString(datas));
            for (ResetOrderAudit audit : datas) {
                log.info("重置订单稽核静态数据 单个：{}", JSON.toJSONString(audit));
                /*staticReportApi.resetOrderAuditStaticReport(audit.getThreeLevelChannelNo(),
                        audit.getSpOrderNo());*/
            }
        } catch (Exception ex) {
            log.error("重置订单稽核静态数据异常", ex);
            throw new ServiceException(ex.getMessage(), ex);
        }
    }
}
